package com.loveofsoftware.fotolab.effects;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;

public class GrayScaleInitialEffect implements InitialEffects {
	
	public static float saturation = 0;

	public Bitmap transform(Bitmap in) {
		int width, height;
		height = in.getHeight();
		width = in.getWidth();

		System.out.println("Saturation level for Gray Scale Effect : "+saturation);
		Bitmap bmpGrayscale = Bitmap.createBitmap(width, height,
				Bitmap.Config.RGB_565);
		Canvas c = new Canvas(bmpGrayscale);
		Paint paint = new Paint();
		ColorMatrix cm = new ColorMatrix();
		cm.setSaturation(saturation);
		ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
		paint.setColorFilter(f);
		c.drawBitmap(in, 0, 0, paint);
		return bmpGrayscale;
	}

}
